package com.jf.identity.controller;

import com.jf.identity.entity.Paper;
import com.jf.identity.entity.ResponseBean;
import com.jf.identity.exception.ServiceException;
import com.jf.identity.service.PaperService;
import com.jf.identity.util.Params;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by x on 2018/4/13.
 */
@Controller
@RequestMapping("/cdm/")
public class PaperController {
    @Resource
    private PaperService paperService;

    @RequestMapping(value = "set-paper-spare-info")
    @ResponseBody
    public ResponseBean setPaperSpareInfo(@Validated @RequestBody Paper paper,
                                          BindingResult bindingResult) {
        Params.beanValidate(bindingResult);
        return new ResponseBean(paperService.insertSparePaperInfo(paper));
    }
}
